$(function() {


    $.ajax({
        url: '/api/swipers',
        method: 'get',
        success: function(res) {
            var html = template('tpl', res)
            $('#kr_carousel').append(html)
            layui.use('carousel', function() {
                var carousel = layui.carousel;
                //建造实例
                carousel.render({
                    elem: '#kr_carousel',
                    width: '720px' //设置容器宽度
                        ,
                    arrow: 'always' //始终显示箭头
                        //,anim: 'updown' //切换动画方式
                });
            });
        }
    })


    $.ajax({
        url: '/api/links',
        method: 'get',
        success: function(res) {
            var html = template('tpl2', res)
            $('.kr_collaborator').append(html)
        }
    })
})